package com.oocl.chatroom.server.sender;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;

import org.json.JSONObject;

import com.oocl.chatroom.network.protocol.Message;

public class Sender implements Runnable{
    private Message msg;
    private PrintWriter oot;
    
    
    public Sender(Message msg,PrintWriter oot){
    	this.msg =  msg;
    	this.oot = oot;
    	
    }
    
    public Sender(){
    	
    }
    
	public void run() {
		JSONObject jOb = new JSONObject(msg);
		String json = jOb.toString();
			synchronized(oot){
				oot.println(json);
				oot.flush();
			}
		
	}

	public Message getMsg() {
		return msg;
	}

	public void setMsg(Message msg) {
		this.msg = msg;
	}

	public PrintWriter getOot() {
		return oot;
	}

	public void setOot(PrintWriter oot) {
		this.oot = oot;
	}
	
	
	

}
